<%-- 
    Document   : stationedit
    Created on : Dec 9, 2012, 3:40:21 PM
    Author     : harker777
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Transport controller</title>
        <link href="css/header.css" rel="stylesheet" type="text/css" />
        <link href="css/common.css" rel="stylesheet" type="text/css" />
        <link href="css/menu.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <%@include file="header.jsp" %>
        <%@include file="menu.jsp" %>
        
        <div class="maincontent">
            <div class="box" style="padding:5px">
                <form method="POST" id="stationedit" class="entityeditform">
                    <input type="hidden" name="action" value="savestation" />
                    <input type="hidden" name="id" value="${station.id}" />
                    <table>
                        <tr>
                            <td colspan="2">
                                <h2> Editing station #${station.id} </h2>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Name: 
                            </td>
                            <td>
                                <input type="text" name="name" value="${station.name}" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Lattitude:
                            </td>
                            <td>
                                <input type="number" name="lattitude" value="${station.lattitude}" 
                                       min="50.4" max="50.6" step="0.0001" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Longitude:
                            </td>
                            <td>
                                <input type="number" name="longitude" value="${station.longitude}" 
                                       min="30.5" max="30.7" step="0.0001" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center;">
                                Types available:
                            </td>
                        </tr>
                        <c:forEach items="${types}" var="type">
                            <tr>
                                <c:forEach items="${station.typesList}" var="stationType">
                                    <c:if test="${stationType.transportTypeId eq type.id}">
                                        <td>
                                        </td>
                                        <td>
                                            <c:if test="${stationType.status eq 'true'}">
                                                <input name="type_${type.id}" 
                                                       checked type="checkbox" />
                                            </c:if>
                                            <c:if test="${stationType.status eq 'false'}">
                                                <input name="type_${type.id}"
                                                       type="checkbox" />
                                            </c:if>
                                            ${type.name}
                                        </td>
                                    </c:if>
                                </c:forEach>
                            </tr>
                        </c:forEach>
                    </table>
                    <table>
                        <tr>
                            <td width="50%">
                                <input type="submit" value="Save" class="button" />
                            </td>
                            <td width="50%">
                                <input type="reset" value="Reset" class="button" />
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </body>
</html>
